package com.fcg.multiproject01.webmodule.controller;

import com.alibaba.fastjson.JSON;
import com.fcg.multiproject01.commonmodule.bean.NodeBean;
import com.fcg.multiproject01.webmodule.config.SysConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author FCG
 */
@Slf4j
@RestController
public class NodeController {
    @Resource
    private SysConfig sysConfig;

    @RequestMapping("node")
    public Object getNodes() {
        NodeBean left = NodeBean.builder().name("left01").build();
        NodeBean right = NodeBean.builder().name("right01").build();
        NodeBean root = NodeBean.builder().name("root").left(left).right(right).build();
        String str = JSON.toJSONString(root);
        log.info(str);
        log.info(sysConfig.toString());
        return str;
    }

    @RequestMapping("sysconf")
    public Object getSysConf() {
        log.info(sysConfig.toString());
        return sysConfig.toString();
    }
}

